<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ include file="/parameter.jsp"%>
<%@page isELIgnored="false"%>
<c:set var="i" value="1" />
<c:forEach items="${TopicList}" var="topicList" varStatus="vs">
<% 
	//<--<c:set var="index" value="${index + 1}" scope="request" />-->
	//<-- 每一次循环，index+1 -->
%>

	<c:choose>
		<c:when test="${'0' != topicList.level}">
			<div class="post">
		</c:when>
		<c:otherwise>
				<c:choose>
					<c:when test="${vs.count % 2 == 0}">
						<div class="post">
					</c:when>
					<c:otherwise>
						<div class="post odd">
					</c:otherwise>
				</c:choose>
		</c:otherwise>
	</c:choose>

	<div>&#8226;&nbsp;<span class="key"><c:if test="${topicList.postkey != null && topicList.postkey != ''}">[${topicList.postkey}]</c:if></span><A
			class="title"
			href="commonAction.do?method=TopicResponsInfo&topid=${topicList.id}">${topicList.title}</A><span
			class="icon"><c:if test="${fn:length(topicList.attlist) > 0}">
				<img src="images/common.gif" />
			</c:if> <c:if test="${topicList.essence == '1'}">
				<img src="images/jing.gif" />
			</c:if> <c:if test="${topicList.sorttype == '1'}">
				<img src="images/zding.gif" />
			</c:if>
		</span> <span><a href="commonAction.do?method=ViewUserInfo&uid=${topicList.postuser.id}">${topicList.postuser.nickname}</a>
		</span><span>( <fmt:formatDate value="${topicList.date}" type="both"/> )</span>
	</div>
	
	<div class="mng">
    <c:if test="${topicList.historical != '1'}">
		<c:if test="${null != sessionScope.user}">
			<c:if
				test="${(topicList.board.boarduser.id == sessionScope.user.id) || (sessionScope.user.usergrade == '0')}">
				<a href="commonAction.do?method=TopicOrResponsEdit&tid=${topicList.id}<c:if test='${topicList.level == 0}'>&type=topic</c:if>">修改编辑</a>&nbsp;&nbsp;<a onclick="DelPost('${topicList.id}');">删除</a>
			</c:if>
		</c:if>

		<c:if test="${null != sessionScope.user}">
			<c:if test="${(topicList.board.boarduser.id == sessionScope.user.id) || (sessionScope.user.usergrade == '0')}">
				<c:if test="${'0' == topicList.level}">
					<select id="move${i}" name="move${i}" onchange="MoveTo('${topicList.id}',this);">
							<option value="" selected>移动到...</option>
							<c:forEach items="${BoardList}" var="boardList">
							<option value="${boardList.id}" >${boardList.boardname}</option>
                            </c:forEach>
					</select>
					<select id="state${i}" name="state${i}" onchange="SetState('${topicList.id}',this);">
							<option value="1"
								<c:if test="${topicList.sorttype == '1'}">selected</c:if>>置顶</option>
							<option value="5"
								<c:if test="${topicList.sorttype == '5'}">selected</c:if>>普通</option>
					</select>
				</c:if>
			<select id="essence${i}" name="essence${i}"
				onchange="SetEssence('${topicList.id}',this);">
				<option value="1"
					<c:if test="${topicList.essence == '1'}">selected</c:if>>精华</option>
				<option value="0"
					<c:if test="${topicList.essence == '0'}">selected</c:if>>普通</option>
			</select>
			</c:if>
            <c:set var="i" value="${i + 1}"/>
		</c:if>
    </c:if>
	</div>

	<c:if test="${fn:length(topicList.respost) > 0}">
		<%
		//<-- 如果有childen -->
		//<!--<c:set var="levelstr" value="${levelstr + 1}" scope="request" />-->
		//<!-- 循环一次子列表，level+1 -->
		%>
		<c:set var="TopicList" value="${topicList.respost}" scope="request" />
		<% 
		//<!-- 注意此处，子列表覆盖treeList，在request作用域 -->
		%>
		<div class="reply">
			<c:import url="__r.jsp" />
			<% 
				//<-- 这就是递归了 -->
			%>
		</div>
	</c:if>

	</div>
</c:forEach>
